#include <stdio.h>
#include <stdbool.h>
bool Runyear(int a) 
{
	if (a % 4 == 0 && a % 100 != 0)
		return 1;
	else if (a % 400 == 0)
		return 1;
	else
		return 0;
}
void PrintRunyear(int a, int b,int x) 
{
	int i = a;
	int count = 0;
	for (i = a; i < b + 1; i++) 
	{
		if (Runyear(i)) 
		{
			printf("%5d ",i);
			count++;
		}
		if (count == x) 
		{
			printf("\n");
			count = 0;
		}		
	}
}

int main() 
{
	int a, b ,x;
	scanf_s("%d %d %d",&a,&b,&x);
	PrintRunyear(a,b,x);
	return 0;
}